package com.jxk.test.event;

import com.jxk.test.entity.User;
import org.springframework.context.ApplicationEvent;

/**
 * @ClassName : MyEvent  //类名
 * @Description :   //描述
 * @Author : jxk  //作者
 * @Date: 2020-09-21 13:54  //时间
 */
public class MyEvent extends ApplicationEvent {
    private User user;
    /**
     * Create a new {@code ApplicationEvent}.
     *
     * @param source the object on which the event initially occurred or with
     *               which the event is associated (never {@code null})
     */
    public MyEvent(Object source,User user) {
        super(source);
        this.user=user;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public void printMsg(String msg)
     {
               System.out.println("监听到事件："+MyEvent.class);
            }
}
